<template>
	<view class="optview spaceEvenly">
		<view class="btnbox spaceEvenly">
			<view class="btn exhibition" v-if="!ticket" @click="add">我要参展</view>
			<view class="btn purchaseTickets" v-if="!ticket" @click="purchaseTickets">立即购票</view>
			<view class="btn purchaseTickets admissionTicket" v-if="ticket" @click="admissionTicket">入场券</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'optview',
		props: {
			data: {
				type: Object,
				default: () => {},
			},
			GoodsItem: {
				type: String,
				default: '',
			},
			ticket: {
				type: Boolean,
				default: false,
			},
			oid:{
				type: String,
				default: '',
			},
		},
		data() {
			return {};
		},
		methods: {
			add() {
				uni.setStorageSync('wbzAdd', this.data);
				uni.navigateTo({
					url: '/pages/wbz/add/add',
				});
			},
			admissionTicket(){
				
				uni.navigateTo({
					url:"/pages/my/admissionTicket/details/details?oid="+this.oid
				})
			},
			async purchaseTickets() {
				const { data } = await this.$api.OrderSubmitOrder({ goods_id: this.data.id, GoodsItem: this.GoodsItem, goods_num: 1 });
				const res = await this.$api.payUnifiedpay({ order_id: data.order_id, url: this.network + 'pages/my/order/details' });
				console.log(res);
				document.querySelector('body').innerHTML = res.data;
				document.forms[0].submit();
			},
		},
	};
</script>

<style lang="scss" scoped>
	.optview {
		bottom: 0;
		position: relative;
		left: 0;
		width: 100%;
		height: 140rpx;
		.btnbox {
			align-items: center;
			height: 140rpx;
			background: #ffffff;
			position: fixed;
			bottom: 0;
			left: 0;
			width: 100%;
		}
		.btn {
			width: 322rpx;
			height: 80rpx;
			border-radius: 40rpx;
			line-height: 80rpx;
			text-align: center;
			color: $price-color;
			border: 2rpx solid $price-color;
		}
		.purchaseTickets {
			background: $price-color;
			color: $txt-color;
		}
		.admissionTicket{
			width: 676rpx;
			
		}
	}
</style>
